/***********************************************************************
filename:   hgeImageManager.h
created:    Sun Jul 19 2009
author:     Paul D Turner <paul@cegui.org.uk>
*************************************************************************/

#ifndef _HgeImageManager_h_
#define _HgeImageManager_h_

#include "hgeSingleton.h"
#include "hgeImage.h"
#include "hgeIteratorBase.h"

#if defined(_MSC_VER)
#   pragma warning(push)
#   pragma warning(disable : 4275)
#   pragma warning(disable : 4251)
#endif

/*!
\brief
Class providing a shared library of Image objects to the system.

The ImageManager is used to create, access, and destroy Image objects.  The
idea is that the ImageManager will function as a central repository for Image
objects used within the GUI system, and that those Image objects can be
accessed, via a unique name, by any interested party within the system.
*/
class ImageManager : public Singleton<ImageManager>       
{
public:
	//! Constructor.
	ImageManager();

	//! Destructor.
	~ImageManager();

	//--------------- Image -----------------
	//! ConstBaseIterator type definition.
	typedef std::map<String, Image*> ImageRegistry;
	typedef ConstBaseIterator<ImageRegistry> ImageIterator;    
	ImageIterator getImageIterator() const;

	//Creates a FreeType type image.
	Image& createImage(const String& image_name, Texture& tex, const hgeRect& area, const Point& offset);
	Image& createImageFromFile(const String& image_name, const String& filename);
	Image& getImage(const String& image_name) const;	
	void destroyImage(ImageRegistry::iterator ob);

	//Notify the ImageManager that display size may have changed.
	void		notifyDisplaySizeChanged(const Size& size);

private:
	ImageRegistry d_images;
};


#if defined(_MSC_VER)
#	pragma warning(pop)
#endif

#endif	// end of guard _HgeImageManager_h_
